package reader.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import reader.mapper.TestMapper;

@Service
public class TestService {
    @Autowired
    private TestMapper testMapper;
    @Transactional(rollbackFor = Exception.class)
    public void batchImport() {
        for (int i = 0; i < 5; i++) {
            if (i == 2) {
                throw new RuntimeException("!");
            }
            testMapper.insertSample();
        }
    }
}
